﻿namespace BaWei.Rabbit.WebApi.Middleware
{
    public class CurrentMiddleware
    {
        //请求委托-RequestDelegate
        private readonly RequestDelegate _next;

        public CurrentMiddleware(RequestDelegate next)
        {
            _next = next;
        }
        //Invoke 名称必须叫 InvokeAsync  异步方法必须以 Async 结尾
        public async Task InvokeAsync(HttpContext context)
        {
            //var request = context.Request.Query["token"];
            //if (string.IsNullOrEmpty(request)) return;
            //if (request != "aabbcc") return;
            //异步将当前请求的传给下一个中间件
            await _next(context);
        }
    }
}
